package sdk.weinxin.beans.massmessage;

import com.fasterxml.jackson.annotation.JsonProperty;

import sdk.weinxin.beans.massmessage.preview.MpnewsPreview;
import sdk.weinxin.beans.massmessage.preview.Preview;
import sdk.weinxin.beans.message.Media;

public class MassMPnewsMessage extends MassMessage {

    private Media mpnews;
    //原创检查命中后行为 1为继续群发（转载），0为停止群发。	该参数默认为0。
    @JsonProperty("send_ignore_reprint")
    private Integer ignoreReprint;

    public MassMPnewsMessage(String mediaId) {
        super();
        mpnews = new Media(mediaId);
        this.setMsgType("mpnews");
    }

    public Media getMpnews() {
        return mpnews;
    }

    public void setMpnews(Media mpnews) {
        this.mpnews = mpnews;
    }

    public Integer getIgnoreReprint() {
        return ignoreReprint;
    }

    public void setIgnoreReprint(Integer ignoreReprint) {
        this.ignoreReprint = ignoreReprint;
    }

    @Override
    public Preview convert() {
        Preview preview = new MpnewsPreview(mpnews.getMediaId());
        if (this.getToUser() != null && this.getToUser().size() > 0) {
            preview.setToUser(this.getToUser().iterator().next());
        }
        return preview;
    }

}
